home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
New Star Software Collection
/
NSS_Collection.iso
/
3-170 dbase 10 for windows
/
1.ima
/
SAMPLES.PAK
/
TESTCLAS.PRG
< prev
next >
Wrap
Text File
|
1993-07-26
|
3KB
|
94 lines
*******************************************************************************
* PROGRAM: Testclas.prg
*
* WRITTEN BY: Borland Late Night Crew
*
* DATE: 6/93
*
* UPDATED:
*
* VERSION: Alpha α
*
* DESCRIPTION: This program shows how to define classes and their properties
* and methods using Bladerunner's object syntax. It creates
* 3 classes: MyClass -- has properties and methods,
* BaseClass -- has one property
* Derived -- derived from BaseClass, contains
* on property of its own.
* It displays and sets the properties of these classes, and
* shows the results of the methods.
*
* PARAMETERS: None
*
* CALLS: None
*
* USAGE: DO Testclas
*
*******************************************************************************
a = new myClass("parm") && instance of myClass
* Display a's properties
? a.x
? a.y
? a.z
? a.goo() && methods
? a.hoo()
? a.zoo()
b = new myClass("parm") && another instance of myClass
b.x = 56 && assign values to the properties of each class instance
a.x = 89
c = new derived() && instance of derived. It will also contain the properties
&& of its parent class -- base
? c.basicVar
? c.extra
*******************************************************************************
class myClass
*******************************************************************************
* Constructor
parameter p
this.x=4
this.y=5
this.z=p
***********************************************
function goo
***********************************************
* member function
? "hello, my name is Goo"
return .t.
***********************************************
function hoo
***********************************************
* member function
? "hello, my name is hoo"
return .t.
***********************************************
function zoo
***********************************************
* member function
? "hello, my name is zoo"
return .t.
endclass
*******************************************************************************
class base
*******************************************************************************
this.basicVar = 1
endclass
*******************************************************************************
class derived of base
*******************************************************************************
this.extra = "Extra extra"
endclass
******************************* End of Testclas.prg ***************************